﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Wap/Shop/ShopSite.Master" AutoEventWireup="true" CodeBehind="SubmitReturnApply_backup.aspx.cs" Inherits="ZLCMS.Web.Wap.Shop.SubmitReturnApply_backup" %>
<%@ Register src="Footer.ascx" tagname="Footer" tagprefix="uc1" %>
    
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
.msg-box{float:right;right:100px;margin-top:-15px;}
	.order_ok{ background:#fff;}
	.order_ok .title span{ color:#8e8e8e; float:right;}
	#mypage .n-ok { display: none;}
/*添加照片*/
p.image_list{ overflow:auto; zoom:1;}
p.image_list .image_item{ float:left; width:30%; text-align:center; margin:0 2.222% 1em; position:relative;}
p.image_list .image_item:nth-child(3n+1){ margin-left:0;}
p.image_list .image_item:nth-child(3n+3){ margin-right:0;}
p.image_list .image_item img{ display:block; width:100%;}
p.image_list #del-btn{ position:absolute; right:0px; top:0px; color:#333; font-family:"微软雅黑"; font-weight:normal; font-size:14px; background:#fff; border-radius:0 0 0 50px; display:block; width:15px; height:20px; padding-left:5px;}
	
    </style>
    <title>提交售后信息</title>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="pages" runat="server">
<div data-role="page" id="mypage">

	<div data-role="header">
	</div><!-- /header -->

	<div role="main" class="ui-content">
        <div class="refundTop">
            <a href="javascript:void(0)" onclick="history.back()" data-ajax="false"><img src="images/arrowLeftCom.png" /></a>
            申请售后
        </div>
        <div class="refundbox">
            <!--s apply_refund-->
            <div class="apply_refund">
                <div class="title">
                    <div class="left">订单号：<span prop="Data.OrderNo">0</span></div>
                    <div class="right" prop="Data.OrderTime"></div>
                </div>
                <div class="productList"></div>
<%--                <div class="box">
                    <div class="left" prop="Data.ThumbnailImg" ></div>
                    <div class="right">
                        <div class="text" prop="Data.ProductName">--</div>
                        <p prop="Data.SkuHtml"></p>
                        <p>￥<span prop="Data.SalePrice">0</span></p>
                    </div>
                </div>--%>
                
       <%--     <div class="order_ok">
            	<div class="title">商品信息</div>--%>
                
         <%--   </div>--%>
            </div>
            <!--e apply_refund-->

            <!--s form-->
            <form command='<%=string.IsNullOrEmpty(Request["pno"])?"Member.ApplyReturnOrder":"Member.ApplyReturnProduct" %>' id="form1">
                <div class="textinput">
                	<select name="sel_reason" data-theme="e" id="sel_reason" data-rule="selectval"  command-param='ReturnType' >
                    <option selected  value="-1">请选择售后原因</option>

                    </select>
                </div>
                <div class="textinput" >
                    <textarea name="" command-param='ReturnMemo' id="ReturnMemo" data-rule="required;wordcount" cols="" rows="" placeholder="请您在此描述详细问题"></textarea>
                </div>
                <div class="addphoto" <%=string.IsNullOrEmpty(Request["pno"])?"style='display:none'":"" %>>
                    <%--<ul class="addphoto_list">
                    
                    </ul>--%>
                     <p class="image_list">
                    </p>
                    <div class="addphoto_upload">
                        <a href="javascript:void(0)"  onclick="javascript: $('.image_list input[type=file]').click();"> 
                            <img src="/wap/shop/images/addphoto.png"><p>上传图片</p>
                        </a>
                    </div>
                    <div style="font-size: 12px; color:#666; margin-top: 10px;">请上传能反映问题的图片，以便商城售后人员能尽快确认并处理问题</div>
                    <div style="font-size: 12px; color:#999;">由于微信限制，图片暂时只能支持一张张上传</div>
                </div>

                <div class="tuikuanbtn">
                 <input id="ImageList" command-param='ImageList' type="hidden" />
                   <input type="hidden" command-param='ProductNo' value='<%=Request["pno"]%>' />
                   <input type="hidden" command-param='OrderNo' value='<%=Request["no"]%>' />
                   <input type="hidden" command-param='ProductSkuNo' value='<%=Request["sku"]%>' />
                   <input type="hidden" command-param='MemberAccount' value="<%=CurrentMemberAccount %>" />
                     <input type="hidden" command-param='ImgUploadMay' value="Default" />

            	<a href="javascript:void(0)" style=" background-color: #f9384c;color: #fff;" onclick="SubmitForm(this)" data-role="button" data-mini="true" data-shadow="false" data-theme="o">提交申请</A>
            </div>
            </form>
            <!--e form-->

        </div>
        
  	</div><!-- /content -->
    
	<div data-role="footer" data-position="fixed" data-tap-toggle="false">    
                <uc1:Footer ID="Footer1" runat="server" MenuId="M" />    
    </div>
        <!-- /footer -->
    
</div>
    <link rel="stylesheet" href="/wap/lib/validator-0.7.0/css/jquery.validator.css" />
    <script type="text/javascript" src="/wap/lib/validator-0.7.0/jquery.validator.js"></script>
    <script type="text/javascript" src="/wap/lib/validator-0.7.0/local/zh_CN.js"></script>
<script src="/wap/lib/common/loaderHandler.js" type="text/javascript"></script>
  <script type="text/javascript" src="/wap/lib/jquery/ajaxfileupload.js"></script>

<script type="text/javascript">
    $(function () {
        var handler = $('.refundbox').loaderHandler();
        handler.initialize({
            command: 'Member.LoadReturnablesDetail',
            parameter: { MemberAccount: '<%=CurrentMemberAccount %>', OrderNo: '<%=Request["no"] %>', ProductNo: '<%=Request["pno"] %>', ProductSkuNo: '<%=Request["sku"] %>' },
            beforeHandleResult: function (result, totalCount, container) {
                var item = '<option value="{Key}">{Value}</option>';
                $(result.ReasonList).each(function () {
                    $("#sel_reason").append(item.format(this));
                });
//                <%if(string.IsNullOrEmpty(Request["pno"])){ %>
//                $("#sel_reason").val(0);
//                $("#sel_reason").selectmenu( "refresh" );
//                $("#sel_reason").selectmenu("disable");
//                <%} %>

                var itemTemp = '<div class="box">' +
                	'<div class="left"><img src="{ThumbnailImg}"></div>' +
                    '<div class="right">' +
                    	'<div class="text">' +
                        '{ProductName}' +
                        '</div>' +
                        '<p>{SkuHtml}</p>' +
                        '<p>￥{SalePrice} * {Counter}件</p>' +
                    '</div>' +
                    '<div class="clear"></div>' +
                '</div>';
                $(result.Data.ProductList).each(function () {
                    this.ThumbnailImg = firstFilePath(this.ThumbnailImg);
                    var skuData = $.parseJSON(this.SkuParamCode);
                    var skuHtml = '';
                    $(skuData).each(function () { skuHtml += '<span>' + this.ItemName + '</span>'; });
                    this.SkuHtml = skuHtml;
                    $('.productList').append(itemTemp.format(this));

                    if (this.Kind == 'shop') {
                        isShowAddr = true;
                    }
                });

            },
            afterHandleResult: function (result, totalCount, container) {

            }
        });
        handler.load();
    });

    $('[prop=Data\\.ThumbnailImg]').bind('valuechange', function (event, param) {

        $('[prop=Data\\.ThumbnailImg]').css({ "background": "url(" + firstFilePath(param.value) + ")", 'background-repeat': 'no-repeat', 'background-position': 'center center', 'background-size': 'cover' });

        $(event.target).triggerHandler('valuechanged', param);
        return false;
    });


    $('input[prop]').bind('valuechange', function (event, param) {
        $(this).val(param.value);
    });

    function SubmitForm(ct) {
        var svrids = '';
        $('.addphoto_list>li[sid]').each(function () { svrids += $(this).attr('sid') + ','; });
        $('#ImageList').val(svrids);

        return executeFormCommonCommand('form1', SubmitApply, SubmitErr);
    }
    function SubmitApply() {
        showTips("提交申请成功，我们会尽快处理！", 500, function () {
            location.replace("ReturnsList.aspx");
        });
    }
    function SubmitErr(errorCode, msg) {
        showTips(msg, 1000, function () { });
    }

    function uploadImage() {
        //执行AJAX上传文件
        $.ajaxFileUpload({
            url: '/Wap/Common/Upload.aspx',
            secureuri: false,
            fileElementId: $('.image_list input[type=file]').attr('id'),
            dataType: 'json',
            success: function (data, status) {
                resetFileControl();
                var item = '<div style="float:left" class="image_item"><img width="80px" src="{FilePath}.thumb.{FileExt}" alt="图片"/><a id="del-btn" href="#">╳</a></div>';
                data.simple.FilePath = $.cookie('imagesvr') + data.simple.FilePath;
                $('.image_list input[type=file]').before(item.format(data.simple));
                var $currentItem = $('.image_list .image_item:last');
                $currentItem.find('a').click(function () {
                    $currentItem.remove();
                });
                $currentItem.attr('data', $.toJSON(data.simple));
            }
        })

    }

    function resetFileControl() {

        //不知为何，不能重复上传文件，只能每次新建一个type=file 的控件
        $('.image_list input[type=file]').remove();
        var fileId = 'file_' + new Date().valueOf();
        $('.image_list').append('<input  id="' + fileId + '" type="file" style="width:1px;height:1px" size="20" name="' + fileId + '"> ');
        $('.image_list input[type=file]').bind('change', function () {

            var val = $(this).val(); //.toLowerCase();
            var ext = val.substring(val.lastIndexOf('.') + 1);
            if ('jpg,jpeg,gif,png,bmp'.indexOf(ext) == '-1') {
                showTips('请上传jpg,jpeg,gif,png,bmp格式图片');
                //return;
            }
            //confirmDialog("请确认上传此文件", function () {
            uploadImage();
            //})

        });
    }

    $(document).ready(function () {
        resetFileControl();
        $(document).ajaxStart(function (o, s) {
            $.mobile.loading("show", {
                text: "正在上传中，请稍候...",
                textVisible: true
            });
        });
        $(document).ajaxComplete(function (o, s) {
            $.mobile.loading("hide");
        });
    });



</script>
</asp:Content>
